|
|
Thanks for the nice comments. Here's some information for those
interested in the structure of the object.
I started with my non-recursive Menger Sponger isosurface function...
function
{
max
(
#declare Level = 4;
#declare Size = 0.5;
#while (Level > 0)
#declare Size = Size / 3;
min(Size-abs(mod(x,Size*6)-Size*3),Size-abs(mod(y,Size*6)-Size*3)),
min(Size-abs(mod(y,Size*6)-Size*3),Size-abs(mod(z,Size*6)-Size*3)),
min(Size-abs(mod(z,Size*6)-Size*3),Size-abs(mod(x,Size*6)-Size*3))
#declare Level = Level - 1;
#if (Level > 0) , #end
#end
)
}
Contained and chopped the corners off with further "max" constraints to
form a cuboctahedron...
#declare Sponge = function
{
max
(
#declare Level = 4;
#declare Size = 0.5;
#while (Level > 0)
#declare Size = Size / 3;
min(Size-abs(mod(x,Size*6)-Size*3),Size-abs(mod(y,Size*6)-Size*3)),
min(Size-abs(mod(y,Size*6)-Size*3),Size-abs(mod(z,Size*6)-Size*3)),
min(Size-abs(mod(z,Size*6)-Size*3),Size-abs(mod(x,Size*6)-Size*3)),
#declare Level = Level - 1;
#end
x-1, -x,
y-1, -y,
z-1, -z,
-x+y-z-0.5,
+x+y-z-1.5,
-x-y-z+0.5,
+x-y-z-0.5,
-x+y+z-1.5,
+x+y+z-2.5,
-x-y+z-0.5,
+x-y+z-1.5
)
}
Then made a mapping that transformed any coordinate within a sphere to a
coordinate within the cuboctahedron such that any point on the surface
of the sphere would also fall on the surface of the cuboctahedron...
#declare SphereTransX = function { x * sqrt(x*x+y*y+z*z) /
max(abs(x),abs(y),abs(z),(abs(x)+abs(y)+abs(z))/2) }
#declare SphereTransY = function { y * sqrt(x*x+y*y+z*z) /
max(abs(x),abs(y),abs(z),(abs(x)+abs(y)+abs(z))/2) }
#declare SphereTransZ = function { z * sqrt(x*x+y*y+z*z) /
max(abs(x),abs(y),abs(z),(abs(x)+abs(y)+abs(z))/2) }
From there I could simply define my Sphere Sponge as...
#declare SphereSponge = isosurface
{
function
{
Sponge
(
SphereTransX(x-0.5,y-0.5,z-0.5)+0.5,
SphereTransY(x-0.5,y-0.5,z-0.5)+0.5,
SphereTransZ(x-0.5,y-0.5,z-0.5)+0.5
)
}
contained_by { sphere { 0.5, 0.5 } }
}
Post a reply to this message
|
|